package com.eques.util

import android.content.Context
import com.eques.service.DoorBellService

object AppUtils {
    private val TAG = AppUtils::class.java.simpleName
    private var application: BaseAppApplication? = BaseAppApplication.instance
    private var myService: DoorBellService? = null
    fun setApplication(application: BaseAppApplication?) {
        AppUtils.application = application
    }

    val context: Context
        get() {
            if (application == null) {
                application = BaseAppApplication.instance
            }
            return application!!.applicationContext
        }

    var service: DoorBellService?
        get() {
            if (myService == null) {
                myService = DoorBellService.getServiceInstance()
            }
            return myService
        }
        set(myService) {
            AppUtils.myService = myService
        }
}
